| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/LibreOffice/help/en-US/text/sbasic/shared/ |
Upload File : |
<!DOCTYPE html> <html lang="en-US" dir="ltr"> <head> <base href="../../../../"> <noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Support for VBA Macros</title> <link rel="shortcut icon" href="media/navigation/favicon.ico"> <link type="text/css" href="normalize.css" rel="Stylesheet"> <link type="text/css" href="prism.css" rel="Stylesheet"> <link type="text/css" href="default.css" rel="Stylesheet"> <script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1"> </head> <body> <header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules"> <button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav> </div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks"> <input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div> </div></div> <div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication"> <a name="support_for_vba_macros"></a> <h1 id="hd_id051720170332046289" dir="auto"> <a name="vbamacros"></a>Working with VBA Macros</h1> <p id="par_id05172017033242490" class="paragraph" dir="auto"><span class="avis">Visual Basic for Applications (VBA) is an implementation of Microsoft's Visual Basic which is built into all Microsoft Office applications. </span></p> <p id="par_id051720170332428854" class="paragraph" dir="auto">Support for VBA is not complete, but it covers a large portion of the common usage patterns. Most macros use a manageable subset of objects in the Excel API (such as the Range, Worksheet, Workbook, etc.) and the support include those objects, and the most commonly used method/properties of those objects.</p> <h2 id="hd_id051720170350145604" dir="auto">Loading Microsoft Office documents with executable VBA macros</h2> <p id="par_id051720170350147298" class="paragraph" dir="auto">Choose <span id="swlnsystextsbasicsharedvbasupportxml_1" class="switchinline"><span hidden="true" id="MACtextsbasicsharedvbasupportxml_1" class="MAC"><span class="emph">LibreOffice - Preferences</span></span><span hidden="true" id="defaulttextsbasicsharedvbasupportxml_1"><span class="emph">Tools - Options</span></span></span><span class="emph"> - Load/Save - VBA Properties</span> and mark the <span class="emph">Executable code</span> checkbox. Then load or open your document.</p> <div class="embedded"> <a name="executablecode"></a> <h4 id="hd_id0523200811475727" dir="auto">Executable code</h4> <p id="par_id0523200811475733" class="paragraph" dir="auto"><span class="avis">The VBA (Visual Basic for Applications) code will be loaded ready to be executed. If this checkbox is not checked, the VBA code will be commented out so it can be inspected, but will not run.</span></p> <div class="tip"> <div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div> <div class="notetext"><p id="par_id05172017121531273" dir="auto">After loading the VBA code, LibreOffice inserts the statement <span class="literal">Option VBASupport 1</span> in every Basic module to enable a limited support for VBA statements, functions and objects. See <a target="_top" href="en-US/text/sbasic/shared/03103350.html">Option VBASupport Statement</a> for more information.</p></div> </div> <br> </div> <h2 id="hd_id051720170400536628" dir="auto">Running VBA Macros</h2> <p id="par_id051720170400539565" class="paragraph" dir="auto">Run VBA macros in the same way as LibreOffice Basic macros.</p> <div class="warning"> <div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="Warning Icon " style="width:40px;height:40px;"></div> <div class="notetext"><p dir="auto">Since support for VBA is not complete, you may have to edit the VBA code and complete the missing support with LibreOffice Basic objects, statements and functions.</p></div> </div> <br> <h2 id="hd_id051720170400533411" dir="auto">Editing VBA Macros</h2> <p id="par_id051720170400532486" class="paragraph" dir="auto">VBA macros can be edited in the LibreOffice Basic IDE.</p> <a name="relatedtopics"></a><div class="relatedtopics"> <p class="related" itemprop="mentions" dir="auto"><a name="related"></a><span class="emph">Related Topics</span> </p> <div class="relatedbody" itemprop="mentions"> <p id="par_id051720171119254111" class="paragraph" dir="auto"><a target="_top" href="en-US/text/shared/optionen/01130100.html">VBA Properties</a></p> <p id="par_id051720170407401872" class="paragraph" dir="auto"><a target="_top" href="en-US/text/sbasic/shared/01030000.html">LibreOffice Basic IDE</a></p> </div> </div> </div> <div id="DonationFrame"></div> <footer><div id="DEBUG" class="debug"> <h3 class="bug">Help content debug info:</h3> <p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/vbasupport.xhp" target="_blank">/text/sbasic/shared/vbasupport.xhp</a></p> <p dir="auto">Title is: Support for VBA Macros</p> <p id="bm_module" dir="auto"></p> <p id="bm_system" dir="auto"></p> <p id="bm_HID" dir="auto"></p> </div></footer> </body> </html>